<template>
	<view class="content" @click="toHome">
		<view v-show="showJump" class="main-skip-btn" @click.stop="userSkip(1)">{{skip}}</view>
		<!-- <view class="firing-title">
			AI期货通
		</view>
		<view class="firing-but" @click="toHome">
			智能交易，从 AI 期货通开始！
		</view> -->
		<!-- <view class="skip" @click="toHome">
			跳过
		</view> -->
	</view>
</template>

<script>
	export default {
		data() {
			return {
				title: 'Hello',
				isLogin: false,
				skip: '3s 跳过',
				showJump: true, // 控制倒计时显示
				userRead: true,
				inter: ''
			}
		},
		onLoad() {
			// var token= uni.getStorageSync('token');
			// if(!!token) this.isLogin =true;
			this.countDown()
		},
		methods: {
			toHome() {
				clearInterval(this.inter)
				// uni.switchTab({
				// 	url: '/pages/tabBar/home/home'
				// });
			},
			countDown() {
				let that = this,
					time = 3;
				that.skip = time + "s 跳过",
				clearInterval(that.inter)
				that.inter = setInterval(function() {
					// console.log('在执行', time)
					that.showJump = true
					time--
					that.skip = time + "s 跳过"  
					if (time < 0) {
						time = 0
						clearInterval(that.inter)
						that.skip = "点击跳过"
						if(that.userRead) {that.userSkip()}
					}
				}, 1000)
			},
			
			userSkip(type) {
				let that = this
				clearInterval(that.inter)
				uni.switchTab({
					url: '/pages/tabBar/home/home'
				})
			},
		}
	}
</script>

<style scoped>
	.content {
		padding-top: 248rpx;
		height: 100vh;
		display: flex;
		flex-direction: column;
		align-items: center;
		background-image: url('../../static/home/firing.png');
		background-size: 100% 100%;
		box-sizing: border-box;
	}
	.firing-title {
		font-size: 64rpx;
		font-family: PingFang SC, PingFang SC;
		font-weight: bold;
		color: #E9381A;
	}
	.firing-but {
		width: 494rpx;
		height: 72rpx;
		background: linear-gradient(180deg, #FEA43D 0%, #E73117 100%);
		border-radius: 44rpx 44rpx 44rpx 44rpx;
		opacity: 1;
		font-size: 28rpx;
		font-family: PingFang SC, PingFang SC;
		font-weight: 400;
		color: #FFFFFF;
		line-height: 72rpx;
		text-align: center;
	}
	
	.main-skip-btn {
		width: 130rpx;
		height: 50rpx;
		display: flex;
		justify-content: center;
		align-items: center;
		position: absolute;
		top: 117rpx;
		right: 56rpx;
		background: rgba(0, 0, 0, 0.7);
		border-radius: 34px;
		font-size: 25rpx;
		font-family: PingFangSC-Regular, PingFang SC;
		font-weight: 400;
		color: #FFFFFF;
		line-height: 36rpx;
		z-index: 2;
	}
</style>
